package main

import "fmt"

func main() {
	s := []string{"炭烤生蚝", "麻辣小龙虾", "干锅鸭"}
	s2 := make([]*string, len(s))
	fmt.Printf("%p, %v\n", &s[0], s[0])
	fmt.Printf("%p, %v\n", s2, s2)
	for i, v := range s {
		fmt.Printf("%v, %v\n", &v, v)
		s2[i] = &v
	}
	fmt.Println(s2)
	v := ""
	for i := 0; i < len(s); i++ {
		v = s[i]
		fmt.Printf("%p, %v\n", &v, v)
	}

	x := *new([]int)
	fmt.Println(x)
	b := append(x, 1)
	fmt.Println(x)
	fmt.Println(b)
	y := make([]int, 1)
	copy(y, x)
	fmt.Println(y)
	type Class struct {
		name string
	}
	type Person struct {
		name  string
		class Class
	}

	sxx := []Person{Person{"li", Class{"1"}}, Person{"x", Class{"2"}}}
	xxs := make([]Person, 2)
	copy(xxs, sxx)
	fmt.Println(xxs)
	xxx := fizzBuzzSwitch(20)
	fmt.Println(xxx)

	// m := make(map[string]int)
	f := func(a, b int) int {
		return a + b
	}
	f(1, 2)

	xxxx := clousure(1)
	xxxx(1, 2)
	const (
		_  = iota
		KB = 1 << (10 * iota)
		GB
		TB
	)
	fmt.Println(KB, GB, TB)

}
func clousure(h int) func(int, int) int {
	return func(a, b int) int {
		return h + a + b
	}
}

func fizzBuzzSwitch(i int) string {
	s := ""
	switch {
	case i%3 == 0 && i%5 == 0:
		s = "fizzbuzz"
	case i%3 == 0:
		s = "fizz"

	case i%5 == 0:
		s = "buzz"

	default:
		s = ""
	}
	return s
}
